<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>物资信息添加页面</title>
		<%@ include file="../../common/jsp/header.jsp"%>
		<link href="<%=path%>static/css/plugins/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet">
		<script type="text/javascript" src="<%=path%>/static/js/plugins/ztree/jquery.ztree.core-3.5.js"></script>
		<script language="JavaScript">
			function beforeClick(treeId, treeNode) {

			}

			function onClick(e, treeId, treeNode) {
				var zTree = $.fn.zTree.getZTreeObj("tree"),
						nodes = zTree.getSelectedNodes(),
						v = "";
				id="";
				nodes.sort(function compare(a,b){return a.id-b.id;});
				for (var i=0, l=nodes.length; i<l; i++) {
					v += nodes[i].name + ",";
					id +=nodes[i].id + ",";
				}
				if (v.length > 0 ) v = v.substring(0, v.length-1);
				if (id.length > 0 ) id = id.substring(0, id.length-1);
				var cityObj = $("#citySel");
				cityObj.attr("value", v);
				var gamTypeId=$("#gamTypeId");
				gamTypeId.attr("value",id);
				$.post(root+"masterials/queryGrand.do?gamTypeId="+id,function (data) {

					$("#gamType").val(data[1].name);
					$("#gamGroup").val(data[0].name);
				},"json")

			}

			function showMenu() {
				var cityObj = $("#citySel");
				var cityOffset = $("#citySel").offset();
				$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

				$("body").bind("mousedown", onBodyDown);
			}
			function hideMenu() {
				$("#menuContent").fadeOut("fast");
				$("body").unbind("mousedown", onBodyDown);
			}
			function onBodyDown(event) {
				if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
					hideMenu();
				}
			}
			$(function () {
				var setting = {
					view: {
						dblClickExpand: false
					},
					data: {
						simpleData: {
							enable: true
						}
					},
					callback: {
						beforeClick: beforeClick,
						onClick: onClick
					}
				};
				$.post(root+"type/queryAlltype.do",function (zNodes) {
					$.fn.zTree.init($("#tree"), setting, zNodes);
				},"json")

			});
			function getVolume() {
				var long = $("#gamLong").val();
				var width = $("#gamWidth").val();
				var high = $("#gamHigh").val();
				if(long!=""&&width!=""&&high!=""){
					$("#gamVolume").val(long*width*high);
				}

			}

		</script>

	</head>
	<body>
	<div class="wrapper wrapper-content animated fadeInRight">
		<div>
			<div class="col-sm-4"><input type="button" value="返回上一页" class="btn btn-success" onclick="javascript:history.back();"/></div>
		</div>
		<div class="ibox float-e-margins">
			<form action="${path}/masterials/create.do" method="post" class="form-horizontal" enctype="multipart/form-data">
				<input type="hidden" name="gamTypeId" id="gamTypeId" readonly>
				<fieldset>
					<legend>物资基本信息</legend>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="ds_host">物资分类</label>
						<div class="col-sm-4">
							  <div class="col-sm-10">
							<input  class="form-control"  id="citySel" type="text"   readonly />
							<div id="menuContent" class="menuContent" style="display:none;">
								<ul id="tree" class="ztree" style="margin-top:0; width:160px;"></ul>
							</div>
						</div>
							<div class="col-sm-2">
								<a id="menuBtn" href="#" onclick="showMenu(); return false;">
									<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
							</div>
						</div>
						<label class="col-sm-2 control-label" for="ds_name">物资名称</label>
						<div class="col-sm-4">
							<input class="form-control" type="text" name="gamName" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="ds_username">物资规格</label>
						<div class="col-sm-4">
							<input class="form-control" type="text"  name="gamSize" />
						</div>
						<label class="col-sm-2 control-label" for="ds_username">物资简称</label>
						<div class="col-sm-4">
							<input class="form-control" type="text"  name="gamAbbname" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="ds_host">物资简述</label>
						<div class="col-sm-8">
							<textarea class="form-control" rows="3" name="gamAbstract"></textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="ds_host" >图片信息</label>
						<div class="col-sm-4">
							<input  type="file" size="30" name="gamPictureFile" />
						</div>
					</div>
				</fieldset>
				<fieldset>
					<legend></legend>
					<div class="form-group">
						<label for="disabledSelect" class="col-sm-2 control-label">是否赋码</label>
						<div class="col-sm-4">
							<div class="col-sm-2"><input type="radio" name="gamIsfuma" id="optionsRadios1" value="0" />&nbsp;&nbsp;否</div>
							<div class="col-sm-2">	<input type="radio" name="gamIsfuma" id="optionsRadios2" value="1" />&nbsp;&nbsp;是</div>
						</div>
						<label class="col-sm-2 control-label" for="ds_host">物资类型</label>
						<div class="col-sm-4">
							<input class="form-control" type="text" name="gamType" id="gamType" readonly />
						</div>
					</div>
					<div class="form-group">
						<label for="disabledSelect" class="col-sm-2 control-label">是否合同采购</label>
						<div class="col-sm-4">
							<div class="col-sm-2"><input type="radio" name="gamIshtcg" id="optionsRadios3" value="0" >&nbsp;&nbsp;否</div>
							<div class="col-sm-2"><input type="radio" name="gamIshtcg" id="optionsRadios4" value="1" >&nbsp;&nbsp;是</div>
						</div>
						<label class="col-sm-2 control-label" for="ds_host">物资组</label>
						<div class="col-sm-4">
							<input class="form-control" type="text" name="gamGroup" id="gamGroup" readonly />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label" for="ds_host">保质期</label>
						<div class="col-sm-3">
							<input class="form-control" type="text" name="gamExpdate" />

						</div>
						<label class="col-sm-1 control-label" for="ds_name">税率</label>
						<div class="col-sm-3">
							<zhg:select codeTp="recent" name="gamShuilv" cls="form-control" def="true"></zhg:select>
						</div>
						<label class="col-sm-1 control-label" for="ds_name">基本单位</label>
						<div class="col-sm-3">
							<zhg:select codeTp="WeightUtils" name="gamBaseunit" cls="form-control" def="true"></zhg:select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label" for="ds_host">生产单位</label>
						<div class="col-sm-3">
							<zhg:select codeTp="WeightUtils" name="gamProunit" cls="form-control" def="true"></zhg:select>
						</div>
						<label class="col-sm-1 control-label" for="ds_name">净重</label>
						<div class="col-sm-3">
							<input class="form-control" type="text" name="gamNetWeight" />
						</div>
						<label class="col-sm-1 control-label" for="ds_name">毛重</label>
						<div class="col-sm-3">
							<input class="form-control" type="text" name="gamGrossweight" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label" for="ds_host">长</label>
						<div class="col-sm-1">
							<input class="form-control" type="text" name="gamLong" id="gamLong"/>
						</div>
						<label class="col-sm-1 control-label" for="ds_name">宽</label>
						<div class="col-sm-1">
							<input class="form-control" type="text" name="gamWidth" id="gamWidth" />
						</div>
						<label class="col-sm-1 control-label" for="ds_name">高</label>
						<div class="col-sm-1">
							<input class="form-control" type="text" name="gamHigh" id="gamHigh" onblur="getVolume()"/>
						</div>
						<label class="col-sm-1 control-label" for="ds_name">体积</label>
						<div class="col-sm-1">
							<input class="form-control" type="text" name="gamVolume" id="gamVolume" readonly/>
						</div>
						<label class="col-sm-1 control-label" for="ds_name">单位</label>
						<div class="col-sm-3">
							<zhg:select codeTp="LongUtils" name="gamVunit" cls="form-control" def="true"></zhg:select>
						</div>
					</div>
				</fieldset>
				<fieldset>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="ds_host"></label>
						<div class="col-sm-4">
							<input type="submit" value="提交" class="btn btn-primary"/>
						</div>
						<label class="col-sm-2 control-label" for="ds_host"></label>
						<div class="col-sm-4">
							<input type="reset" value="重置" class="btn btn-danger" id="resetForm"/>
						</div>
					</div>
				</fieldset>
			</form>
		</div>
	</div>

	</body>
	<script type="text/javascript" src="${path}/static/js/plugins/file-input/fileinput.min.js"></script>
	<script type="text/javascript" src="./js/dictionary.js"></script>
</html>